package com.hliushi.utils

import com.typesafe.config.{Config, ConfigFactory}

/**
 * descriptions: 配置文件加载类
 *
 * author: Hliushi
 * date: 2021/6/4 20:23
 */
object GlobalConfigUtil {

  // 通过工厂加载配置
  val config: Config = ConfigFactory.load("application")

  //  # Kafka集群地址
  val bootstrapServers: String = config.getString("bootstrap.servers")
  //  # ZooKeeper集群地址
  //val zookeeperConnect: String = config.getString("zookeeper.connect")
  //  # Kafka Topic名称
  //val inputTopic: String = config.getString("input.topic")
  //  # 消费组ID
  val groupId: String = config.getString("group.id")
  //  # 自动提交拉取到消费端的消息offset到kafka
  val enableAutoCommit: String = config.getString("enable.auto.commit")
  //  # 自动提交offset到zookeeper的时间间隔单位（毫秒）
  val autoCommitIntervalMs: String = config.getString("auto.commit.interval.ms")
  //  # 每次消费最新的数据
  val autoOffsetReset: String = config.getString("auto.offset.reset")

  //  # key和value序列化类
  val keyDeserializer: String = config.getString("key.deserializer")
  val valueDeserializer: String = config.getString("value.deserializer")

  def main(args: Array[String]): Unit = {
    println(bootstrapServers)
    //println(zookeeperConnect)
    //println(inputTopic)
    println(groupId)
    println(enableAutoCommit)
    println(autoCommitIntervalMs)
    println(autoOffsetReset)
    println(keyDeserializer)
    println(valueDeserializer)
  }
}